<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}

$page = !($_POST['pageNum'])?'1':intval($_POST['pageNum']);
$pagesize= !($_POST['numPerPage'])?'20':intval($_POST['numPerPage']);


if(empty($pagesize)){
    $pagesize=20;
}
$frmnum=($page-1)*$pagesize;
$orderField=trim($_POST["orderField"]);
$orderDirection=trim($_POST["orderDirection"]);
if(empty($orderField)){
    $orderField="id";
}
if(empty($orderDirection)){
    $orderDirection="desc";
}
if($orderField<>""){
    $order=" order by $orderField ".$orderDirection;
}else{
    $order=" order by id desc";
}

$q=trim($_POST['q']);
$usergroup=ez_get_cache("usergroup");

    if(!empty($usergroup)){
        $usergroupdata[0]="所有用户";
        while(list($k,$trow)=each($usergroup)){
           $usergroupdata[$k]=$trow["title"]; 
        }
        
    }else{
        $usergroupdata=array(0=>"所有用户");
    }
    
    
$total=$ezhand->count("message_group","`subject` like '%$q%'");
$row=$ezhand->select_all("message_group",'*','`subject` like "%'.$q.'%"'.$where.' '.$order.' limit '.$frmnum.','.$pagesize);

?>